<template>
	<view class="shoc">
		<!-- <view class="ullist"> -->
		<!-- <view :class="active==1 ? 'active' : '' " @click="dzclick(1)" style="margin-left: 80rpx;">商品</view> -->
		<!-- <view class="shux"></view>
			<view :class="active==2 ? 'active' : '' " @click="dzclick(2) " style="margin-right: 80rpx;">店铺</view> -->

		<!-- </view> -->
		<view>
			<view class="list flex0-end bg-fff p-30 mt-15" v-for="(item,index) in ListInfo" :key="index" @click="godp(item.goods_id)">
				<view class="im1 ">
					<image :src="item.goods_image_url" mode=""></image>
				</view>
				<view class="content">
					<view class="f-24">{{item.goods_name}}</view>
					<view class="flex0 bottm c-333">
						<view class="f-24 c-333 center" @click.stop="delt(item.goods_id)">
							<view class="im3">
								<image :src="`${picUrl}/w/dels.png`" mode=""></image>
							</view>
							<view class="f-24">
								删除
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="None" v-if="ListInfo&&ListInfo.length<=0">
			<image style="width: 100%;" :src="`${picUrl}/InfoNull.png`" mode="widthFix"></image>
		</view>
		<view v-if="fav_type=='store'&&ListInfo.length<=0">
			<image style="width: 100%;" :src="`${picUrl}/InfoNull.png`" mode="widthFix"></image>
		</view>

	</view>
</template>

<script>
	const util = require("@/common/api_sign/request.js")
	export default {
		data() {
			return {
				active: 1,
				ListInfo: [],
				fav_type: "goods",
				curpage: 1
			}
		},
		methods: {
			GetList() { //获取列表信息
				let that = this;
				console.log(this.fav_type)
				util.request({
					url: '/mobile/index.php?act=member_favorites&op=favorites_list',
					method: 'get',
					data: {
						curpage: that.curpage,
						fav_type: that.fav_type,
					},
				}).then(function(res) {
					that.ListInfo = res.datas.favorites_list;
					console.log(res)
				})
			},

			dzclick(id) {
				this.active = id;
				if (id == 1) {
					this.fav_type = "goods"
				} else if (id == 2) {
					this.fav_type = "store"
				}
				this.GetList();
			},
			delt(id) {
				uni.showModal({
					title: '提示',
					content: '是否删除此收藏',
					success: (res) => {
						if (res.confirm) {
							util.request({
								url: '/mobile/index.php?act=member_favorites&op=favorites_del',
								method: 'POST',
								data: {
									fav_id: id
								}
							}).then(res => {
								console.log(res)
								if (res.error_code == 0) {
									uni.showToast({
										title: '删除成功！'
									})
									this.GetList()
								} else {
									uni.showToast({
										title: res.message,
										icon: 'none'
									})
								}
							})
						}
					}
				});
			},
			godp(index) {
				uni.navigateTo({
					url: '/mall/goods/info?goods_id=' + index
				})
			}
		},
		created() {
			this.GetList();
		},
	}
</script>

<style>
	.None {
		height: 100%;
		background-color: #fff;
	}

	.shoc {
		height: 100%;
	}

	.shoc .bottm {
		position: absolute;
		bottom: 0;
		right: 0;
	}

	.shoc .list .im1 {
		margin-right: 20upx;
	}

	.shoc .list .im1 image {
		width: 167upx;
		height: 167upx;
	}

	.shoc .list .im2 image {
		width: 39upx;
		height: 35upx;
	}

	.shoc .list .im3 image {
		width: 29upx;
		height: 35upx;
	}

	/*  */
	.ullist {
		display: flex;
		font-size: 24upx;
		justify-content: space-around;
		color: #333;
		padding: 15upx 0;
		background-color: #fff;
		align-items: center;
	}

	.ullist .shux {
		width: 2upx;
		height: 40upx;
		background-color: #ccc;
	}

	.ullist .active {
		color: #ff4300;
		padding: 0 10upx;
		padding-bottom: 10upx;

		border-bottom: 2upx solid #ff4300;
	}

	.content {
		width: 500rpx;
		height: 180rpx;
		position: relative;
	}
</style>